/* 
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */


#ifndef IMAGEWIDGET_H
#define IMAGEWIDGET_H

#include <QFrame>
#include <QLabel>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QStackedLayout>
#include <QMovie>
#include <QByteArray>
#include <QBuffer>

#include "extracontainer.h"

class ImageWidget : public QFrame
{
	Q_OBJECT
public:
	ImageWidget(QWidget* parent = 0);
	virtual ~ImageWidget();

	void setStaticImage(const QImage& image);
	void setAnimatedImage(const QByteArray& animimage);
	void setLoadingImage();
	bool isClear();
	bool isAnimated();

	void setSaved(bool s);
	bool isSaved();

	Wishmaster::ExtraContainer extraContainer();
	void setExtraContainer(Wishmaster::ExtraContainer container);

	QStringList tags();
	void setTags(const QStringList& tags);

	int imageId();
	void setImageId(int id);

	QImage image();
	QByteArray array();

public slots:
	void update();
	void zoom();
	void unzoom();

protected slots:
	void animResized(const QSize& size);

private:
	QStackedLayout* m_layout;
	QLabel* m_label;
	QGraphicsItem* m_item;
	QGraphicsScene* m_scene;
	QGraphicsView* m_view;
	QMovie* m_movie;
	QByteArray m_arr;
	QBuffer m_buffer;
	QImage m_image;
	Wishmaster::ExtraContainer m_container;
	QStringList m_tags;
	bool m_saved;
	bool m_clear;
	bool m_animated;
	int m_imageID;
};

#endif

